<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <h1>HELLO Index</h1>
    <input type="file" id="uploadInput" />
    <button onclick="upload(document.getElementById('uploadInput'))">
      保存
    </button>
    <script src="./axios.min.js"></script>
    <script>
      const request = axios.create({
        baseURL: "http://127.0.0.1:8090/api/collections",
      });
      function upload(el) {
        const avatar = el.files[0];
        const data = new FormData();
        data.append("emailVisibility", true);
        data.append("password", "12345678");
        data.append("passwordConfirm", "12345678");
        data.append("avatar", avatar);
        request.post("/users/records", data).then((data) => console.log(data));
      }
    </script>
  </body>
</html>
